package cn.edu.nuc.ssm.dao;

import cn.edu.nuc.ssm.entity.BbsSection;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface BbsSectionMapper {
    @Delete({
        "delete from bbs_section",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into bbs_section (id, uid, ",
        "sname, introduct, ",
        "topic_count,section_type)",
        "values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, ",
        "#{sname,jdbcType=VARCHAR}, #{introduct,jdbcType=VARCHAR}, ",
        "#{topicCount,jdbcType=INTEGER},#{sectionType,jdbcType=VARCHAR})"
    })
    int insert(BbsSection record);

    int insertSelective(BbsSection record);

    @Select({
        "select",
        "id, uid, sname, introduct, topic_count,section_type",
        "from bbs_section",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("cn.edu.nuc.ssm.dao.BbsSectionMapper.BaseResultMap")
    BbsSection selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(BbsSection record);

    @Update({
        "update bbs_section",
        "set uid = #{uid,jdbcType=INTEGER},",
          "sname = #{sname,jdbcType=VARCHAR},",
          "introduct = #{introduct,jdbcType=VARCHAR},",
          "topic_count = #{topicCount,jdbcType=INTEGER},section_type = #{sectionType,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(BbsSection record);

    List<String> findSectionType();

   List<BbsSection> findbySectionType(@Param("sectionType")String sectionType);


    List<String> findAllSectionType();

    List<BbsSection> find();

    BbsSection findbyId(@Param("id")Integer id);

    int updatetopicCountBYId(@Param("updatedTopicCount")Integer updatedTopicCount,@Param("id")Integer id);


    List<BbsSection> findbySname(@Param("sname")String sname);







}